#!/usr/bin/python3

import json

if __name__ == '__main__':
    result = []
    for line in open("results.log", "rb").read().split(b"\n"):
        try:
            x = json.loads(line)
            if x.get("partial_success") or x.get("success"):
                exp = x.get("experiment")
                if exp:
                    chain = exp.get("chain")
                    if len(chain)==1:
                        addr = chain[0][0]
                        port = chain[0][1]
                        result += [ {"addrport":(addr, port)} ]
        except json.decoder.JSONDecodeError as e:
            pass

    print (json.dumps(result))

    
